package org.tsdb;


import com.stumbleupon.async.Deferred;
import net.opentsdb.core.DataPoint;
import net.opentsdb.core.TSDB;
import net.opentsdb.tools.OpenTSDBMain;
import net.opentsdb.utils.Config;
import org.hbase.async.HBaseClient;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class OpenTSDBExample {

    public static void main(String[] args) throws IOException {
        Config config = new Config(true);
        HBaseClient hbaseClient = new HBaseClient("172.21.11.3:2181", "/hbase");
        TSDB bd = new TSDB(hbaseClient,config);
        Map<String ,String > tags = new HashMap<>();
        tags.put("deviceId","test");
        Deferred<Object> result  = bd.addPoint("ly.ts",System.currentTimeMillis(),System.currentTimeMillis(),tags);

        result.addCallback((b)->{
            System.out.println(b);
            return true;
        });

    }
}

